<?php
namespace Common\Extend\Api;
/**
 * This is just an example.
 */
class ApiClient{
    //const HttpClient     = '';
    protected $HttpClient  = '';
    public function __construct(){
        require 'autoload.php';
        $this->HttpClient = new HttpClient;
    }
    public function credit(){       //4098144471555613
        $taobao = new \Credit\Auth('4098144471555613','VAwVyuhELYsbkADRoyYyvtMk8qTTUxmJ');
        return $taobao;
    }
    public function mobile(){
        $taobao = new \Mobile\Auth('4098144471555613','VAwVyuhELYsbkADRoyYyvtMk8qTTUxmJ');
        return $taobao;
    }

   public function sms(){
        $data  =  [
            ['username'=>'xixiqianbao','password'=>'meilian123','apikey'=>'9a5d19a316f4385f22b2aaa8455cc308'],
            ['username'=>'xixiqianbao1','password'=>'cunyun123','apikey'=>'77ae88172179ed79d7eeb3924b4422a6'],
            ['username'=>'xixiqianbao2','password'=>'cunyun123','apikey'=>'641c3db5245176c20d0521f093d736e5'],
            ['username'=>'xixiqianbao3','password'=>'cunyun123','apikey'=>'12a52f52fbc43494e372e57a1ed8c571'],
        ];
       $rand   = array_rand($data,1);
       $config = $data[$rand];
       //$config = ['xixiqianbao','meilian123','9a5d19a316f4385f22b2aaa8455cc308'];
       $taobao = new \Sms\Auth($config);//'xixiqianbao',md5('meilian123'),'9a5d19a316f4385f22b2aaa8455cc308'
       return $taobao;
    }

    public function alipay(){

        $APPID             = '2018020602149590';
        //私钥
        $APP_PRIVATE_KEY   = 'MIIEpQIBAAKCAQEAum9NDqVACMkCTccZMC0TRqkXHVd/aP2OqmL51V9zOtQvR9QZn0eYpy8OjUn+Df+I7KZwClDbZAxrWZ3l6GsvCfUKjEHyG8cpHCvkAdsMJvh7mkmtb5j4SjVb+mdNou1rXhAU/V0YXYGsg5/qtI7Icr+6dFViHKLxY5rRwmkxaUZWvqg3LXqmqa/0LRMEe5kOCt+LLxeGYnx2S2CKTur8tGkya+ZLykFiaKyb6Wx1T03kDW/iMlNMFzVdHyGDsIL0sGVgwrH2we0BdRo99CXgwxu5JZj7bFF9ztoXP7aXdqFQq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DNK7ukdAoGAeR14V9VpPmdqW6SvXK90WDQKWUakoSW8uwmlKCvydOiywpLePj2pCJ0PN7KpGPGbpdQrJ9UptE9Vd3OaYhLGPWf1FtFa9aCBJ1AqoS2LY9W501tdwUt/1Cu2ozEy9sDESEGpMW63bJe6Rs5mU7brhLxmOZ6NtP9daS8haYHSsX0=';

        

        // $APPID             = '2017070507654765';
        // //私钥
        // $APP_PRIVATE_KEY   = 'MIICXAIBAAKBgQCnDuX71WXgtxr3Y5OuxM25I2mYutWput3grKSyzD+7Nvv0gLWVtZEXBIUT9xOSWKSnKVaHGv0JF6+TkQc4thW0fByW+Lhf523PeafuzBVi7XpFbHiz8H9Fup06ma14xbflZ1oinQc96HuLomYT0H/dAeFTcGRxiBp+jZnAceaFRwIDAQABAoGAH6LvpMhd2bdzUOQ3pII6n1P4fGbtbY4o1JJ9Qirx6sdX4Y66VJak2mINvaEtwKouzEVE0KMoxh8JLf3qCzBYXZ5LU5OVyDOjD19TNk4DD1CFSjtv51vLgUmu85ulp2YB+RFWIMTUJCsYLy/mMIeqw+AFaz7w7whCkh836zeC6/kCQQDQEGGnpFSxZt3M9lw0Yt4C2hv/CYu6EU5OrJF20kuQqKrJIwNsM2k5LyGod5dAfiwK+qqLxqgHZgWR/4FfnKpbAkEAzYv+jeD/KAQeMzXB2BY+THzVRod1sX4DMhjwXnZfRpBkkRJsqocem0h9MuUszSi/Uz3Nf4/IMwMDBarnZf1MhQJAHdbrmnZX6yVclAOVD7JKMtCDCV2eG25V87SOHCNm0PVPoQ8Tc5Yf9iKLSjT0jTxLJrvyb59rA7ye+eRR8ptuVwJASZthfBNfrEfVPMd6dFR62M83XPtzZS1YHZ+arGk9czqQGPd9HJAooLkTxJ8XLRzzbu7J4W1u5v2kHmp2VSqhNQJBAIPLEcKnbjYykQgSCAm//uHdlyIuPpQ/vbtNo3cYTeoUnlVE66Xw5FTg+/Zqhmp6j1QlJpWlP2jAzsAUEqYGtAA=';
        //公钥
        //$ALIPAY_PUBLIC_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAQyJkJ+rAfUW/B7i/sR7vf6pGaiumUqXkp6vtiSPv+LDo16PGtNP/qL1ewQu2ePwXMCYf/RWkTkWwrRMw74PmVSt3PFyMXOJRGk+w4Ux+6DqqJRogjcFoZpe6NeJPXhE8/7bq3Oc45eljR95ODCEXKChPcrQbnBS52ayGsfpbdwIDAQAB';
        $ALIPAY_PUBLIC_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB';
        $taobao = new \Alipay\Auth($APPID,$APP_PRIVATE_KEY,$ALIPAY_PUBLIC_KEY);
        return $taobao;
    }
    /*
     * 短信发送
     */
  /*  public function sns(){
        $sns = new \Sns\Auth('1001@501164030001','D6226BF3AE85A78848E5A2B5D68D8758','50116403','4765');
        return $sns;
    }*/

    public function alipay2(){
        $APPID             = '2017123001370787';
        //私钥
        $APP_PRIVATE_KEY   = 'MIICXQIBAAKBgQCgWrCCPEDRSnTkSrfqklc0x/BI10IrfT6fIInoQ6v/n1ONHBjlWV6rRzFMsqvZOQQFVjor02yGw/FpiBfAGcGV1ooYSgupVi2+drEc4kHM+i+UzZZS2TttBkkvtQLwvk9uOu9gE+NTGFNOfZYt+RT6iPwdUpV2Zw1y0k9bb8tjMQIDAQABAoGBAJmdp6BsFnApUwfsqHoYTWCr9X3icWp2JkqNAnA2fAx7VrBE7Xixf+a3Yfwm4khLvZVbQIkBluMXzSqbDJ2kTvU2e6zvQIo4TBHdTzAE/1cXzo24mPYaKFLs3dGGy5rzOGdTr6EJ0u9qcT7wv/wFsYjpUy/8sY0NzaFLDjIeYWSdAkEA1cIUuruDUwRy3v8XVZT0gaj+r9Xgxlr0x/dzvOjZwHicfRfuva5otqjWE9hLC/yJFOZ+oKAYfA3/QWy9TskKLwJBAMAK7sfui/Bvot7lqpp2xNhTJ331XGvphYC4C9RL6QKH67ozVMWRg/PGCXrHKvcer//Waai7niRM/2TmGnA+8J8CQQCCYX0PYOx7KI2AYwuykcaJh7DBQ610j2oaxl577XNUKL0auAxQ+h64u0bIl/c+emyKqQS3qK8Gi+sT1uWpNorVAkAZLJW2kbe4cfnovDSMAQu2y9e+dD6ESt1cTUQHtVe7JDQreXUgXP3uI8S0Wo1wTY6GvAWnv8hwO8Oy51MJ6cZDAkBVRVdOccp9hjMTk75fptA7ySIjLzV5XTlYekmKjHVHymnvGTUZ7SYRBTqQCy+WhY1ziGqtISRnMGWmCHpbaAwa';
        //公钥
        //$ALIPAY_PUBLIC_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAQyJkJ+rAfUW/B7i/sR7vf6pGaiumUqXkp6vtiSPv+LDo16PGtNP/qL1ewQu2ePwXMCYf/RWkTkWwrRMw74PmVSt3PFyMXOJRGk+w4Ux+6DqqJRogjcFoZpe6NeJPXhE8/7bq3Oc45eljR95ODCEXKChPcrQbnBS52ayGsfpbdwIDAQAB';
        $ALIPAY_PUBLIC_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB';
        $taobao = new \Alipay\Auth($APPID,$APP_PRIVATE_KEY,$ALIPAY_PUBLIC_KEY);
        return $taobao;
    }



     public function alipay3(){
           $APPID             = '2017112200092713';
        //私钥
        $APP_PRIVATE_KEY   = 'MIICXQIBAAKBgQC5d3ld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EY);
        return $taobao;
    }


}
